package com.teach;

import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;

/**
 * <pre>
 * - 输出格式:2019年01月01日 周一 01时01分01秒
 * Author : J.L.Zhou
 * E-Mail : 2233875735@qq.com
 * Tel : 151 1104 7708
 * Date : 2021-4-16 11:04:42
 * Version : 1.0
 * Copyright 2021 jlzhou.top Inc. All rights reserved.
 * Warning: this content is only for internal circulation of the company.
 *          It is forbidden to divulge it or use it for other commercial purposes.
 * </pre>
 *
 */
public class Demo0302 {

	public static void main(String[] args) {
		System.out.println(format(LocalDateTime.now()));
		System.out.println(format(LocalDateTime.now().plusDays(1)));
		System.out.println(format(LocalDateTime.now().plusDays(2)));
	}
	
	public static String ws = " 一二三四五六日";
	
	public static String format(LocalDateTime d) {
		StringBuilder sb = new StringBuilder();
		sb.append(d.getYear());
		sb.append('年');
		if(d.getMonth().getValue()<10) {
			sb.append('0');
		}
		sb.append(d.getMonthValue());
		sb.append('月');
		
		if(d.getDayOfMonth()<10) {
			sb.append('0');
		}
		sb.append(d.getDayOfMonth());
		sb.append("日 周");
		sb.append(ws.charAt(d.getDayOfWeek().getValue()));
//		sb.append(d.getDayOfWeek().getValue());
		sb.append(' ');
		
		if(d.getHour()<10) {
			sb.append('0');
		}
		sb.append(d.getHour());
		sb.append("时");
		
		if(d.getMinute()<10) {
			sb.append('0');
		}
		sb.append(d.getMinute());
		sb.append("分");
		
		if(d.getSecond()<10) {
			sb.append('0');
		}
		sb.append(d.getSecond());
		sb.append("秒");

		return sb.toString();
	}
}
